package imagingbook.sift.scalespace;


public class GaussianOctave extends ScaleOctave {
	
	GaussianOctave(int p, int Q, ScaleLevel Gbot, int botIndex, int topIndex, double sigma_0) {
		super(p, Q, Gbot, botIndex, topIndex);
		this.sigma_0 = sigma_0;	// reference scale at level 0 of this octave
		double sigmaA_bot = getAbsoluteScale(p, botIndex);
		Gbot.setAbsoluteScale(sigmaA_bot);
		//IJ.log("sigmaA_init=" + sigmaA_bot);
		
		for (int q = botIndex+1; q <= topIndex; q++) {
			double sigmaA_q = getAbsoluteScale(p, q);
			double sigmaR_q = Math.sqrt(sigmaA_q*sigmaA_q - sigmaA_bot*sigmaA_bot) / Math.pow(2, p);
			//IJ.log("p=" + p + " q=" + q + "  sigmaRel_q=" + sigmaR_q + " sigmaAbs=" + sigmaA_q);
			ScaleLevel G_pq = Gbot.duplicate();
			G_pq.filterGaussian(sigmaR_q);
			G_pq.setAbsoluteScale(sigmaA_q);
			this.setLevel(q, G_pq);
		}
	}
	
}
